// 封装购物车相关接口
import request from "@/utils/http";

// 加入购物车
export const insertCartAPI = (data) => {
  return request({
    url: "/gscloud_product/a/shop_cart/change_item",
    method: "POST",
    data: data,
  });
};

// 获取最新的购物车列表
export const findNewCartListAPI = () => {
  return request({
    url: "/gscloud_product/a/shop_cart/info",
  });
};

// 购物车数量
export const prodCountAPI = () => {
  return request({
    url: "/gscloud_product/a/shop_cart/prod_count",
  });
};

// 勾选购物车
export const checkItemsAPI = (data) => {
  return request({
    url: "/gscloud_product/a/shop_cart/check_items",
    method: "POST",
    data,
  });
};

// 全选购物车
export const checkAllItemsAPI = (params) => {
  return request({
    url: "/gscloud_product/a/shop_cart/check_all_items",
    method: "POST",
    params,
  });
};

// 删除购物车
export const delCartAPI = (data) => {
  return request({
    url: "/gscloud_product/a/shop_cart/delete_item",
    method: "DELETE",
    data,
  });
};

// 合并购物车

export const mergeCartAPI = (data) => {
  return request({
    url: "/member/cart/merge",
    method: "POST",
    data,
  });
};
